<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:th="http://www.thymeleaf.org"
	xmlns:winter="http://www.winter.org"
	xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
	layout:decorator="/layouts/layout">
<head>
	<title>Escriba - Vehiculos</title>
</head>
<body>
	<section layout:fragment="content">
		<winter:output id="VehiculosOutput">
			<form id="VehiculosForm" th:object="${vehiculos}" class="form">
				<div id="BarraVehiculos" class="headerbar" th:if="${vehiculos.context.lista}">
					<div class="form-title" th:text="@{'Vehiculos'}">Vehiculos</div>
				    	<winter:row>
				    		<winter:column type="col-md-4">
				    	   		<winter:inputtext
									id="VehiculoFiltroChasis" 
									field="*{filtros.nrochasis}"
									label="#{label.vehiculo.nrochasis}"
									labeldisplay="col-xs-4"
									inputdisplay="col-xs-8"
									containerdisplay="row padded"
									class="winter-input-text capitalize">
								</winter:inputtext>
				    	   </winter:column>
				    	   <winter:column type="col-md-4">
				    	   		<winter:inputtext
									id="VehiculoFiltroSerie" 
									field="*{filtros.nroserie}"
									label="#{label.vehiculo.nroserie}"
									labeldisplay="col-xs-4"
									inputdisplay="col-xs-8"
									containerdisplay="row padded"
									class="winter-input-text capitalize">
								</winter:inputtext>
				    	   </winter:column>
			    	   <winter:column type="col-md-4">
			    	   		<winter:inputtext
								id="VehiculoFiltroChapa" 
								field="*{filtros.Chapa}" 
								label="#{label.vehiculo.chapa}"
								labeldisplay="col-xs-4"
								inputdisplay="col-xs-8"
								containerdisplay="row padded"
								class="winter-input-text capitalize">
							</winter:inputtext>
			    	   </winter:column>
			    	 </winter:row>
			    	 <winter:row class="button-panel-right" padded="true">
						<winter:ajaxsubmit 
							id="@{'ConsultarVehiculos'}" 
							form="VehiculosForm"
							url="@{'/vehiculos/consultar'}" 
							update="VehiculosOutput"
							value="Consultar"
							object="vehiculos"
							effect="fade"
							showstatus="true"
							class="btn btn-cyan"
							immediate="true">
						</winter:ajaxsubmit>
						<winter:ajaxsubmit 
							id="@{'AgregarVehiculo'}" 
							form="VehiculosForm"
							url="@{'/vehiculos/agregarVehiculo'}" 
							update="VehiculosOutput"
							value="Agregar Vehiculo"
							object="vehiculos"
							effect="fade"
							showstatus="true"
							class="btn btn-cyan"
							immediate="true">
						</winter:ajaxsubmit>
					</winter:row>
				</div>			
				<div th:text="#{mensaje.vehiculos.vacio}" class="info-message" th:if="${!vehiculos.context.vehiculo and #lists.isEmpty(vehiculos.vehiculos)}">
				</div>
				<winter:output id="TablaVehiculos">
					<winter:datatable 
						id="ListaVehiculos"
						customLanguage="true"
						paginate="true"
						jQuery="true"
						retrieve="true"
						emptyTableText="No se encontraron Datos!"
						infoText="Mostrando _START_ al _END_ de _TOTAL_ registros"
						emptyTableInfoText="Mostrando 0 al 0 de 0 registros"
						searchText="Buscar"
						lengthMenu="Mostrar _MENU_ registros"
						if="${vehiculos.context.lista and !#lists.isEmpty(vehiculos.vehiculos)}">
						<thead>
							<tr>
							    <th th:text="#{label.vehiculo.nrochasis}"></th>
							    <th th:text="#{label.vehiculo.nroserie}"></th>
							    <th th:text="#{label.vehiculo.chapa}"></th>
							    <th th:text="#{label.vehiculo.certificado.serie.nro}"></th>
							    <th th:text="#{label.vehiculo.activo}"></th>
								<th th:text="#{label.common.operaciones}"></th>
							</tr>
						</thead>
						<tbody>
							<tr th:each="vehiculoItem, rowStat : ${vehiculos.vehiculos}" style="line-height: 2em;">
								<td th:text="${vehiculoItem.nrochasis}" class="align-left"></td>
								<td th:text="${vehiculoItem.nroserie}" class="align-left"></td>
								<td th:text="${vehiculoItem.chapa}" class="align-left"></td>
								<td th:text="@{${#objects.nullSafe(vehiculoItem.certificadonro,default)}}" class="align-left"></td>
								<td th:text="${vehiculos.descEstado(vehiculoItem.activo)}" class="align-left"></td>
								<td class="tabla-operaciones" width="10px">
									<div class="button-toolbar">
										<winter:ajaxlink 
											id="@{${rowStat.index}+'EditarVehiculo'}" 
											form="VehiculosForm"
											url="@{'/vehiculos/editarVehiculo/'+${rowStat.index}}" 
											update="VehiculosOutput"
											title="Editar"
											tip="true"
											object="vehiculos"
											effect="fade"
											showstatus="true"
											immediate="true"
											class="ajax-submit icon-edit-sign icon-2x">
										</winter:ajaxlink>
										<winter:ajaxlink 
											id="@{${rowStat.index}+'EliminarVehiculo'}" 
											form="VehiculosForm"
											url="@{'/vehiculos/deleteVehiculo/'+${rowStat.index}}" 
											update="VehiculosOutput"
											title="Eliminar"
											tip="true"
											object="vehiculos"
											effect="fade"
											showstatus="true"
											immediate="true"
											class="ajax-submit icon-remove-sign icon-2x"
											confirmationrequired="true"
							                confirmationtext="Está seguro que desea realizar la operación?">
										</winter:ajaxlink>
									</div>
								</td>
							</tr>
						</tbody>
					</winter:datatable>
				</winter:output>
				<div th:if="${vehiculos.context.vehiculo}" class="regla">
					<div id="CrearEditarVehiculo" th:include="/gestion/vehiculo :: vehiculo">
	  				</div>
				</div>					
			</form>
		</winter:output>
	</section>
</body>
</html>